<?php
General::getTpl()->assign('extraTitle',"Wartung/Backup");

require_once './kernel/maintenance.php';

if(!Admin::checkPermission('canMaintain')) {
	General::ouputMessage('Fehler','Sie haben nicht gen&uuml;gend Rechte um diese Seite zu betrachten');
}else{
	
	if(isset($_GET['do']) && $_GET['do'] == "optimizeTables") {
		Maintenance::optimizeTables(
			Settings::getInstance()->getSetting("General.sqlDb"),
			Settings::getInstance()->getSetting("General.sqlPre"));
	}elseif(isset($_GET['do']) && $_GET['do'] == "backupTables") {
		Maintenance::backupTables(
			Settings::getInstance()->getSetting("General.sqlDb"),
			Settings::getInstance()->getSetting("General.sqlPre"),
			false);
	}elseif(isset($_GET['do']) && $_GET['do'] == "backupTablesWith") {
		Maintenance::backupTables(
			Settings::getInstance()->getSetting("General.sqlDb"),
			Settings::getInstance()->getSetting("General.sqlPre"),
			true);
	}
	
	General::getTpl()->assign('body',
		General::getTpl()->fetch('../admin/maintain.html'));
}
?>